package sights.scenic_detail.dao;

import sights.VO.ScenicDetailVO;
import sights.scenic_detail.model.Scenic_detail;
import util.JdbcUtil;
import util.PageModel;

import java.util.List;
import java.util.Map;

public class Sc_de_daoImpl implements Sc_de_dao{
    @Override
    public List<Scenic_detail> selectByPage(PageModel pageModel) {
       return null;

    }

    @Override
    public ScenicDetailVO selectById(Integer sight_id) {
        String sql="select sd.sight_id,sd.history_background,sd.cul_features,sd.specialty,ss.sight_name,ss.city,ss.img_path from scenic_detail sd join scenic_spot ss on " +
                "sd.sight_id=ss.sight_id where sd.sight_id=?";
        List<Map<String,Object>>list= JdbcUtil.selectBySql(sql,sight_id);
        Map<String,Object>map=list.get(0);
        String sight_name=(String) map.get("sight_name");
        String city=(String)map.get("city");
        String history_background=(String) map.get("history_background");
        String cul_features=(String) map.get("cul_features");
        String specialty=(String) map.get("specialty");
        String img_path=(String)map.get("img_path");
        ScenicDetailVO vo = new ScenicDetailVO();
        vo.setSightId(sight_id);
        vo.setSightName(sight_name);
        vo.setCity(city);
        vo.setHistoryBackground(history_background);
        vo.setCulFeatures(cul_features);
        vo.setSpecialty(specialty);
        vo.setImgPath(img_path);
        return vo;
    }

    @Override
    public int saveOne(Scenic_detail scenic_detail) {
        return 0;
    }

    @Override
    public int updateOne(Scenic_detail scenic_detail) {
        return 0;
    }

    @Override
    public int deleteOne(Scenic_detail scenic_detail) {
        return 0;
    }
}
